DIBadMount
DIBadMount
Process a disk insert event that caused an error #include <DiskInit.h> Disk Initialization Package
Point globalPt ; top-left corner of DI dialog (global coordinates) event and the returned message indicates an error (the high word is
non-zero). It draws a dialog and (if the user OKs it) formats the disk and sets
up an empty directory, block map, and volume information.
globalPt is a Point, expressed in global ( screen) coordinates. It identifies where you want to put the top left corner of the "Do you want to
evtMessage is a 32-bit code. The low word identifies the drive on which you
want to format a disk. The high word is an OSErr code as returned
This parameter matches the message field of an EventRecord returned by GetNextEvent when the what field has been set to Returns: an integer result code. Negative values are OSErr codes. It will be one of:
(2) There is a mounted volume in the drive
(1) User clicked Eject in DI dialog
noErr (0) No error
extFSErr (-58) External file system
memFulErr (-108) Not enough room in heap
nsDrvErr (-56) No such drive
paramErr (-50) Bad drive number
volOnLinErr (-55) Drive volume already on-line
firstDskErr (-84) ... through ...
lastDskErr (-64) (low-level disk errors)
Notes: By the time you get a diskEvt back from GetNextEvent, the Event Manager has already attempted to mount the volume. If you are using the
lower-level GetOSEvent, then you should attempt to mount it using Most applications can simply ignore disk insertions. If you use Standard
File to get filenames, that package will take care of disk insertions,
ejections, and formatting. If you'd rather do it yourself, you can use the
following sequence:
short rc;
.
:
if ( theEvent.what == diskEvt ) {
if (( theEvent.message & 0xFFFF0000) != 0) {/*err mounting*/
SetPt( &diDlgPt, 100,100 ); rc = DIBadMount( diDlgPt, theEvent. message); /* do it */ if ( rc < 0 ) { ... some error occurred ... }
}
}